﻿@model XPressify.Models.AlbumUploadFileModel
@using XPressify.Models

@{
    ViewBag.Title = "Album file uploads";
}

<script type="text/javascript">

    function successUploadFile() {
        $(".newPostName").show("fast");
        $('.nobtn').css('color', 'blue');
        $('a.ui-dialog-titlebar-close.ui-corner-all').click(); // close popup window
        $('.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix').show(); // show button yes and no// for confirm dialog
    }
</script>

<div>
    @Html.ActionLink("Try simple upload", "AlbumUploadFileSimple", "Album", new { id = Model.Id }, new { @style = "color:Blue" })
</div>
<br />
<br />
<div>
    @using (Html.BeginForm("AlbumUploadFile", "Album", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <table border="0">
        <tr>
        @if (Model.SingleUpload)
        {
            <td style="width:100px;vertical-align:bottom;padding: 3px;">
            @Html.Partial("FileUploaderSingle", new MediaUploadModel { ActionName = Model.ActionName, ControllerName = Model.ControllerName, Id = Model.Id, UserId = Model.UserId, FileExtension = Model.FileExtension, FileDescription = "" })
            </td>
        }
        else
        {
            <td style="width:100px;vertical-align:bottom;padding: 3px;">
            @Html.HiddenFor(model => model.SingleUploadDescription)
            @Html.Partial("FileUploader", new MediaUploadModel { ActionName = Model.ActionName, ControllerName = Model.ControllerName, Id = Model.Id, UserId = Model.UserId, FileExtension = Model.FileExtension })
            </td>
        }
        <td style="vertical-align:bottom">
            <input type="submit" id="btnSave" value="Upload file" />
        </td>
        </tr>
        </table>
    }
</div>

<br />
<div align="right">
@Ajax.ActionLink("Finish", "AlbumFileEdit", "Album", new { id = Model.Id }, new AjaxOptions { UpdateTargetId = Model.OwnerId.ToString(), OnSuccess = "successUploadFile", InsertionMode = System.Web.Mvc.Ajax.InsertionMode.InsertBefore, HttpMethod = "GET" }, new { @class = "abtn" })
</div>